import Taro,  { useState, useEffect } from "@tarojs/taro";

// 通用的loading
export default function useLoading(initialState, loadingText = undefined) {
  const [loading, setLoading] = useState(initialState)
  useEffect(() => {
    if (loading) {
      Taro.showLoading()
    } else {
      Taro.hideLoading()
    }
  }, [loading])
  return [loading, setLoading]
}
